package com.leyou.item.mapper;


import com.leyou.item.entity.TbBrand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<TbBrand> {

    //自定义添加到中间表的方法
    @Insert("insert into tb_category_brand value(#{cid},#{bid})")
    public void addCategoryBrand(@Param("cid") long cid,@Param("bid") long bid);

    //根据cid查询
    @Select("select * from tb_brand  where id in (select brand_id from tb_category_brand where category_id=#{cid} )")
    public List<TbBrand> queryBranByCid(Long cid);

}
